Skip to content

Fix #4037: Fix code generation for generic arrays #4046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Feb 27, 2018

We confused "generic" and "unbounded generic" before, which meant that
AnyRef-bounded generic arrays ignored their ClassTag.

We confused "generic" and "unbounded generic" before, which meant that
AnyRef-bounded generic arrays ignored their ClassTag.
case tp: TypeParamRef => true
case tp: TypeProxy => isGeneric(tp.underlying)
case tp: AndType => isGeneric(tp.tp1) || isGeneric(tp.tp2)
case tp: OrType => isGeneric(tp.tp1) || isGeneric(tp.tp2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why for both A & B and A | B, you have isGeneric(A) || isGeneric(B)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an approximation that makes sure that the erasure would not depend on any possible instantiation of the type. Erasure of AndTypes and OrTypes is quite complex, so it's hard to come up with a narrower condition.

@odersky odersky merged commit 803f324 into scala:master Mar 5, 2018
@Blaisorblade Blaisorblade deleted the fix-#4037 branch March 5, 2018 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants